

<include file="public@header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('order/index')}">全部信息</a></li>
        <li><a href="{:url('order/add')}">添加信息</a></li>
    </ul>

    <form class="well form-inline margin-top-20" method="get" >


        开始时间:
        <input type="text" class="form-control js-bootstrap-datetime" id="start_time" name="start_time"
               style="width: 140px;" autocomplete="off">
        产品名称:
         <input type="text" class="form-control" id="title" style="width: 120px;"  placeholder="请输入产品名称">


        团队:
        <select class="form-control" name="status" id="team_id" style="width: 140px;">
            <option value=''>全部</option>

            <volist name="hezuo" id="hzs">
                <option value='{$hzs.id}'>{$hzs.title}</option>
            </volist>



        </select> &nbsp;&nbsp;


        状态:
        <select class="form-control" name="status" id="status" style="width: 140px;">
            <option value=''>全部</option>
            <option value='1'>报单中</option>
            <option value='2'>已完成</option>
            <option value='3'>已取货</option>
            <option value='4'>已结款</option>
            <option value='5'>已核查</option>

        </select> &nbsp;&nbsp;

        <input type="button" id="selectval" class="btn btn-primary" value="搜索" />


        <a class="btn btn-danger" href="{:url('order/index')}">清空</a>
    </form>

    <table class="table table-hover table-bordered">

        <table class="layui-hide" id="test" lay-filter="test"></table>

        <script type="text/html" id="toolbarDemo">
            <div class="layui-btn-container">
<!--                <button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>-->
<!--                <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>-->
<!--                <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>-->
            </div>
        </script>
        <script type="text/html" id="barDemo">
            <a class="layui-btn layui-btn-xs" lay-event="list">查看订单</a>
            <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>

        <!--    自定义    -->
        <script type="text/html" id="titleTpl">
            {{#  if(d.types ==1 ){ }} 酒类 {{#  } }}
            {{#  if(d.types ==2 ){ }} 手机 {{#  } }}
            {{#  if(d.types ==3 ){ }} 其他 {{#  } }}
        </script>

        <!--    自定义    -->
        <script type="text/html" id="titleTpl1">
            {{#  if(d.status ==1 ){ }} 报单中 {{#  } }}
            {{#  if(d.status ==2 ){ }} 已完成 {{#  } }}
            {{#  if(d.status ==3 ){ }} 已取货 {{#  } }}
            {{#  if(d.status ==4 ){ }} 已结款 {{#  } }}
            {{#  if(d.status ==5 ){ }} 已核查 {{#  } }}

        </script>
        <script>

            layui.use('table', function(){
                var table = layui.table;
                var curl="{:url('order/getlist')}";


                var tableIns =table.render({
                    elem: '#test' ,
                    url:curl,
                    method: 'post',
                    toolbar: '#toolbarDemo',
                    title: '用户数据表',
                    cols: [[

                        {field:'id', title:'ID', width:80}
                        ,{field:'title', title:'名称',edit: 'text'}
                        ,{field:'desc', title:'全部商品',edit: 'text'}
                        ,{field:'types', title:'类型', templet: '#titleTpl'}
                         ,{field:'status', title:'状态', templet: '#titleTpl1'}
                        ,{field:'from', title:'操作'}
                        ,{field:'times', title:'加入时间'}
                        ,{fixed: 'right', title:'操作', toolbar: '#barDemo'}
                    ]]
                    ,page: true
                });


                $("#selectval").click(function (){

                    var start_time=$("#start_time").val();
                    var title=$("#title").val();
                    var status=$("#status").val();
                    var team_id=$('#team_id').val();

                    tableIns.reload({
                        where: { team_id:team_id,start_time:start_time ,title:title,status:status} ,
                        page: { curr: 1  }
                    });

                })

                //表格工具行事件
                table.on('tool(test)', function(obj){
                    var data = obj.data;
                    //console.log(obj)
                    if(obj.event === 'del'){

                        var curl="{:url('order/delete')}";

                        layer.confirm('真的删除行么', function(index){
                            $.ajax({
                                url: curl,
                                data:{'id':data.id},
                                type:'post',
                                success:function (ret){
                                    obj.del();
                                    layer.close(index);
                                }
                            })


                        });
                    } else if(obj.event === 'edit'){

                        var curl="{:url('order/edit')}?id="+data.id;

                        layer.open({
                            type: 2,
                            area: ['700px', '500px'],
                            content: curl,
                            success:function (){
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            }
                        });
                    }else if(obj.event === 'list'){

                        var curl="{:url('order/seeorder')}?id="+data.id;

                        layer.open({
                            type: 2,
                            area: ['1300px', '800px'],
                            content: curl,
                            success:function (){
                               
                            }
                        });
                    }
                });


            });
        </script>


    </table>

</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>